﻿@model Syncar.Web.FrontEnd.Models.Filters
@using Syncar.Web.FrontEnd.Helpers;
@using Syncar.Web.FrontEnd.Models;

<script src="@Url.Content("~/Scripts/jquery.jstree.js")" type="text/javascript"></script>

@functions{
    public String GetFitlerTitleClass(FilterItem filterItem)
    {
        String filterClass = String.Empty;
        filterClass += (filterItem.HasChildsSelected) ? "filter_title_active" : "filter_title";
        filterClass += " " + ((FilterItem.FilterType)filterItem.Type).ToString().ToLower();
        filterClass += (filterItem.IsFixed) ? "filter_fixed" : "";
        return filterClass;
    }
}

<div id="filtersContainer" >
    <div id="filtersContainerWrapper" >
        <div class="reset_all_filters" id="filtersResetAll" onclick="filtersResetAll('@((int)FilterItem.FilterType.All)', '@Url.Action("ApplyFilters")', GetTogglesJSON());" >
            <img class="filterButtonResetAllImage" src="@Url.Content("~/Content/images/filterButtonResetAll.png")" />
            <div class="reset_all_text">
                @ViewRes.SharedResource.ResetAll
            </div>
        </div>
	    <div class="left_menu_filter_container">
            <img class="filterButtonParentImage" src="@Url.Content("~/Content/images/filterButtonParent.png")" />
		    <div href="" class="@GetFitlerTitleClass(Model.LocationRoot) linkFilter" onclick="return false;">
                @ViewRes.SharedResource.Location
            </div>
		    <div id="locationFilters" class="left_menu_filter">
			    <div>
				    @Html.DisplayFor(x => x.LocationRoot.Childs)
			    </div>
		    </div>
	    </div>
	    <div class="left_menu_filter_container">
            <img class="filterButtonParentImage" src="@Url.Content("~/Content/images/filterButtonParent.png")" />
		    <div class="@GetFitlerTitleClass(Model.AgencyRoot) linkFilter">
                @ViewRes.SharedResource.Agency
            </div>
		    <div id="agencyFilters" class="left_menu_filter ">
			    <div>
				    @Html.DisplayFor(x => x.AgencyRoot.Childs)
			    </div>
		    </div>
	    </div>
	    <div class="left_menu_filter_container">
            <img class="filterButtonParentImage" src="@Url.Content("~/Content/images/filterButtonParent.png")" />
		    <div class="@GetFitlerTitleClass(Model.MediaTypeRoot) linkFilter">
                @ViewRes.SharedResource.MediaType
            </div>
		    <div id="mediaTypeFilters" class="left_menu_filter">
			    <div>
				    @Html.DisplayFor(x => x.MediaTypeRoot.Childs)
			    </div>
		    </div>
	    </div>
    </div>
</div>

<div id="divModalDialogDataError" class="divModalDialog">
    <div class="divModalDataError">
        <a href="" style="text-align:left" onclick="return false;">X</a> <!--CLOSE SYMBOL-->
	    <div id="divModalTextError" class="divModalDataErrorText">
		    No Description available
	    </div>	   
    </div>
</div>

<div id="filtersButton" onclick="interactFilters();">
	@Html.Image(Url.Content("~/Content/images/filtersImageCollapsed.png"), "alt text", new { id = "filtersButtonImage" })
    @Html.Image(Url.Content("~/Content/images/filtersImageGlow.png"), "alt text", new { id = "filtersButtonImageGlow" })
</div>
<div class="clearFloat"></div>

<script type="text/javascript">
 
	var locationClass = "@FilterItem.FilterType.Location.ToString().ToLower()";
	var agencyClass = "@FilterItem.FilterType.Agency.ToString().ToLower()";
	var mediaClass = "@FilterItem.FilterType.MediaType.ToString().ToLower()";

	var filterStateEnableID = '@((int)@FilterItem.FilterState.Enable)';
	var filterStateNoDataID = '@((int)@FilterItem.FilterState.NoData)';
	var filterStateDisableID = '@((int)@FilterItem.FilterState.Disable)';

	var locationClassID = '@((int)@FilterItem.FilterType.Location)';
	var agencyClassID = '@((int)@FilterItem.FilterType.Agency)';
	var mediaClassID = '@((int)@FilterItem.FilterType.MediaType)';

	$(document).ready(function () {
		$("#content").addClass("use_sidebar_collapsed");
		filtersSelect(locationClass, agencyClass, mediaClass);
});
</script>

